package com.work.cos.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.work.cos.domain.entity.CreditsLogEntity;
import com.work.cos.mapper.base.ICreditsLogMapper;
import com.work.cos.service.interfc.ICreditsLogService;
import com.work.cos.util.page.PageInfo;

@Service
public class CreditsLogServiceImpl implements ICreditsLogService{

	@Autowired
	private ICreditsLogMapper creditsLogMapper;

	@Override
	public PageInfo<CreditsLogEntity> findCreditsLogByUserId(Long userId, int pageNo, int pageSize) {
		return this.creditsLogMapper.findCreditsLogByUserId(userId, pageNo, pageSize);
	}

	@Override
	@Transactional
	public boolean addCreditsLog(CreditsLogEntity entity) {
		boolean flag =  this.creditsLogMapper.addCreditsLog(entity) > 0;
		if(flag){
			//用户积分字段
			if("add" == entity.getType()){
				
			}else{
				//type--> "pay"(default)
				
			}
		}
		return flag;
	}
	
}
